
<%@ page pageEncoding="UTF-8"%>
<%@ page import="java.net.InetSocketAddress"%>
<%@ page import="java.net.SocketAddress"%>
<%@ page import="java.net.URL"%>
<%@ page import="java.text.DecimalFormat"%>
<%@ page import="java.util.List"%>
<%@ page import="org.jawa.*"%>

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<html>
<head>
<meta name="currentStep" content="1" />
<style type="text/css">
.bar TD {
	padding: 0;
}

.info-header {
	background-color: #eee;
	font-size: 10pt;
}

.info-table {
	margin-right: 12px;
}

.info-table .c1 {
	text-align: right;
	vertical-align: top;
	color: #666;
	font-weight: bold;
	font-size: 9pt;
	white-space: nowrap;
}

.info-table .c2 {
	font-size: 9pt;
	width: 90%;
}
</style>
</head>
<body>
<h1><fmt:message key="setup.title" /></h1>

<p><fmt:message key="setup.env.description" /></p>

<!-- BEGIN jawa-contentBox -->

<h2><fmt:message key="index.current.pc" /></h2>
<table border="0" >
	<tr>
		<td valign="top">
		<table border="0" cellpadding="2" cellspacing="2" width="100%"
			class="info-table">
			<tbody>
				<tr>
					<td class="c1"><fmt:message key="index.jvm" /></td>
					<td class="c2">
					<%
						String vmName = System.getProperty("java.vm.name");
						if (vmName == null) {
							vmName = "";
						} else {
							vmName = " -- " + vmName;
						}
					%> <%=System.getProperty("java.version")%> <%=System.getProperty("java.vendor")%><%=vmName%>
					</td>
				</tr>
				<tr>
					<td class="c1"><fmt:message key="index.app" /></td>
					<td class="c2"><%=application.getServerInfo()%></td>
				</tr>
				<tr>
					<td class="c1"><fmt:message key="index.os" /></td>
					<td class="c2"><%=System.getProperty("os.name")%> / <%=System.getProperty("os.arch")%>
					</td>
				</tr>
				<tr>
					<td class="c1"><fmt:message key="index.local" /></td>
					<td class="c2"><%=Constants.getLocale()%> / <%=Constants.getTimeZone().getDisplayName(
							Constants.getLocale())%> (<%=(Constants.getTimeZone().getRawOffset() / 1000 / 60 / 60)%>
					GMT)</td>
				</tr>
				<tr>
					<td class="c1"><fmt:message key="index.memory" /></td>
					<td>
					<%
						// The java runtime
						Runtime runtime = Runtime.getRuntime();

						double freeMemory = (double) runtime.freeMemory() / (1024 * 1024);
						double maxMemory = (double) runtime.maxMemory() / (1024 * 1024);
						double totalMemory = (double) runtime.totalMemory() / (1024 * 1024);
						double usedMemory = totalMemory - freeMemory;
						double percentFree = ((maxMemory - usedMemory) / maxMemory) * 100.0;
						double percentUsed = 100 - percentFree;
						int percent = 100 - (int) Math.round(percentFree);

						DecimalFormat mbFormat = new DecimalFormat("#0.00");
						DecimalFormat percentFormat = new DecimalFormat("#0.0");
					%>

					<table cellpadding="0" cellspacing="0" border="0" width="300">
						<tr valign="middle">
							<td width="99%" valign="middle">
							<div class="bar">
							<table cellpadding="0" cellspacing="0" border="0" width="100%"
								style="border: 1px #666 solid;">
								<tr>
									<%
										if (percent == 0) {
									%>

									<td width="100%"><img
										src="${ctx}/images/jawa-setup-percent-bar-left.gif"
										width="100%" height="8" border="0" alt=""></td>

									<%
										} else {
									%>

									<%
										if (percent >= 90) {
									%>

									<td  height="8"width="<%=percent%>%"
										background="${ctx}/images/jawa-setup-percent-bar-used-high.gif"><img
										src="${ctx}/images/blank.gif" width="1" height="8" border="0"
										alt=""></td>

									<%
										} else {
									%>

									<td width="<%=percent%>%"
										background="${ctx}/images/jawa-setup-percent-bar-used-low.gif"><img
										src="${ctx}/images/blank.gif" width="1" height="8" border="0"
										alt=""></td>

									<%
										}
									%>
									<td width="<%=(100 - percent)%>%"
										background="${ctx}/images/jawa-setup-percent-bar-left.gif"><img
										src="${ctx}/images/blank.gif" width="1" height="8" border="0"
										alt=""></td>
									<%
										}
									%>
								</tr>
							</table>
							</div>
							</td>
							<td width="1%" nowrap>
							<div style="padding-left: 6px;" class="c2"><%=mbFormat.format(usedMemory)%>
							MB of <%=mbFormat.format(maxMemory)%> MB (<%=percentFormat.format(percentUsed)%>%)
							used</div>
							</td>
						</tr>
					</table>
					</td>
				</tr>
			</tbody>
		</table>
		</td>
	</tr>
</table>
<div class="jawa-contentBox">
	<form action="setup-language-settings.jsp">
	<%
		String ver = System.getProperty("java.version");
		if (ver.compareTo(Constants.getXMLProperty("required.jdk")) <= 0) {
	%>
	<p class="error"><fmt:message key="index.error" /></p>
	<%
		} else {
	%>
	
	<div align="right"><input type="submit" name="save"
		value="<fmt:message key="button.continue" />" id="jawa-setup-save"
		border="0"></div>
	<%
		}
	%>
	</form>
</div>
</body>
</html>
